package com.springboot.astra.service.serviceImpl;

import com.springboot.astra.bean.RoleResource;
import com.springboot.astra.mapper.RoleResourceMapper;
import com.springboot.astra.service.RoleResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RoleResourceServiceImpl implements RoleResourceService {
    @Autowired
    RoleResourceMapper roleResourceMapper;
    @Override
    public List<RoleResource> getAllByRoleId(Integer id) throws Exception {
        return roleResourceMapper.getAllByRoleId(id);
    }

    @Override
    public RoleResource doesRoleResourceExist(RoleResource roleResource) throws Exception {
        return roleResourceMapper.doesRoleResourceExist(roleResource);
    }


    @Override
    public void insertRoleResource(RoleResource roleResource) throws Exception {
            roleResourceMapper.insertRoleResource(roleResource);
    }

    @Override
    public void updateOneById(RoleResource roleResource) throws Exception {
        roleResourceMapper.updateOneById(roleResource);
    }

    @Override
    public void deleteOneById(Integer id) throws Exception {
        roleResourceMapper.deleteOneById(id);
    }

    @Override
    public void deleteAll(Integer roleId) {
        roleResourceMapper.deleteAll(roleId);
    }

}
